﻿using System;

using SBPweb.PROvibe.Shared.Library.Base;
using SBPweb.PROvibe.Shared.Library.Components;

namespace SBPweb.PROvibe.Client.Library.Base
{

    public abstract class ServiceModelBase : IService
    {

        #region Constructor logic

        protected ServiceModelBase(IModule parentModule, string name)
        {
            Parent = parentModule;
            Name = name;
        }

        #endregion

        #region Properties

        public IModule Parent
        {
            get;
            private set;
        }

        public Type Type
        {
            get
            {
                return this.GetType();
            }
        }

        public virtual string Name
        {
            get;
            protected set;
        }

        #endregion

        #region Methods

        public abstract void Initialize();

        public int CompareTo(INameable other)
        {
            if (other == null)
            {
                return 0;
            }
            return this.Name.CompareTo(other.Name);
        }

        public int CompareTo(object obj)
        {
            return CompareTo(obj as INameable);
        }

        #endregion

    }

}